<?
require_once("inc_security.php");

$list = new fsDataGird($id_field,$name_field,translate_text("Listing"));

$list->add('fac_name','Tên nhóm','string',1,1);
$list->add('fg_name','Nhóm','string',0,0);
$list->add('fac_alias','Alias','string',0,0);
$list->add("",translate_text("Edit"),"edit");
$list->add("",translate_text("Delete"),"delete");

$fqgop = get_all_faq_group_options();
$fac_fg_id = getValue("fac_fg_id","int","GET",'0');
$list->addSearch('Nhóm', "fac_fg_id", "array", $fqgop, $fac_fg_id);

$list->ajaxedit($fs_table);
$total			= new db_count("SELECT 	count(*) AS count 
										 FROM 	".$fs_table."
										 WHERE 1". $list->sqlSearch());

$db_listing 	= new db_query("SELECT * 
								 FROM ".$fs_table." INNER JOIN faq_categroup ON fg_id = fac_fg_id
								 WHERE 1".$list->sqlSearch()."
								 ORDER BY ".$list->sqlSort().' ' .$name_field ." ASC
								 " . $list->limit($total->total));
                                 
$total_row		= mysql_num_rows($db_listing->result);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?=$load_header?>
<?=$list->headerScript()?>
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<? /*------------------------------------------------------------------------------------------------*/ ?>
<div>
    <?= $list->showHeader($total_row);?>
    <?
        $i = 0;
        while($row = mysql_fetch_array($db_listing->result)){
            ++$i;
    ?>
    <?=$list->start_tr($i, $row[$id_field])?>
    <td>
        <input type="text" style="width:180px;" value="<?=$row['fac_name']?>" name="<?="fac_name".$row[$id_field]?>" id="fac_name_<?=$row[$id_field]?>" title="<?=$row['fac_name']?>" class="form_control" onkeyup="check_edit('record_<?=$i?>')" />
    </td>
    <td>
        <?=$row['fg_name']?>
    </td>
    <td>
        <?=$row['fac_alias']?>
    </td>
    <?=$list->showEdit($row[$id_field]); ?>
    <?=$list->showDelete($row[$id_field]); ?>
    <?=$list->end_tr();?>
    <?
        }
    ?>
    <?= $list->showFooter($total_row);?>
</div>
<? /*------------------------------------------------------------------------------------------------*/ ?>
</body>
</html>
